<?php require_once('Connections/parkwaydb_connection.php'); ?>
<?php require('scripts/_drawrating.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$maxRows_recent_news = 5;
$pageNum_recent_news = 0;
if (isset($_GET['pageNum_recent_news'])) {
  $pageNum_recent_news = $_GET['pageNum_recent_news'];
}
$startRow_recent_news = $pageNum_recent_news * $maxRows_recent_news;

mysql_select_db($database_parkwaydb_connection, $parkwaydb_connection);
$query_recent_news = "SELECT news_id, news_date, news_title FROM tbl_news ORDER BY news_date DESC";
$query_limit_recent_news = sprintf("%s LIMIT %d, %d", $query_recent_news, $startRow_recent_news, $maxRows_recent_news);
$recent_news = mysql_query($query_limit_recent_news, $parkwaydb_connection) or die(mysql_error());
$row_recent_news = mysql_fetch_assoc($recent_news);

if (isset($_GET['totalRows_recent_news'])) {
  $totalRows_recent_news = $_GET['totalRows_recent_news'];
} else {
  $all_recent_news = mysql_query($query_recent_news);
  $totalRows_recent_news = mysql_num_rows($all_recent_news);
}
$totalPages_recent_news = ceil($totalRows_recent_news/$maxRows_recent_news)-1;

$maxRows_allarticles = 10;
$pageNum_allarticles = 0;
if (isset($_GET['pageNum_allarticles'])) {
  $pageNum_allarticles = $_GET['pageNum_allarticles'];
}
$startRow_allarticles = $pageNum_allarticles * $maxRows_allarticles;

mysql_select_db($database_parkwaydb_connection, $parkwaydb_connection);
$query_allarticles = "SELECT tbl_articles.articles_id, tbl_articles.articles_user_id, tbl_articles.articles_parent_id, tbl_articles.articles_date, tbl_articles.articles_updated, tbl_articles.articles_title, tbl_articles.articles_short, tbl_articles.articles_long, tbl_articles.articles_thumb, tbl_articles.articles_referencelink, tbl_user.user_id, tbl_user.user_firstname, tbl_user.user_familyname, tbl_user.user_email FROM tbl_articles LEFT JOIN tbl_user ON tbl_user.user_id = tbl_articles.articles_user_id ORDER BY tbl_articles.articles_date DESC";
$query_limit_allarticles = sprintf("%s LIMIT %d, %d", $query_allarticles, $startRow_allarticles, $maxRows_allarticles);
$allarticles = mysql_query($query_limit_allarticles, $parkwaydb_connection) or die(mysql_error());
$row_allarticles = mysql_fetch_assoc($allarticles);

if (isset($_GET['totalRows_allarticles'])) {
  $totalRows_allarticles = $_GET['totalRows_allarticles'];
} else {
  $all_allarticles = mysql_query($query_allarticles);
  $totalRows_allarticles = mysql_num_rows($all_allarticles);
}
$totalPages_allarticles = ceil($totalRows_allarticles/$maxRows_allarticles)-1;

$maxRows_alllinks = 10;
$pageNum_alllinks = 0;
if (isset($_GET['pageNum_alllinks'])) {
  $pageNum_alllinks = $_GET['pageNum_alllinks'];
}
$startRow_alllinks = $pageNum_alllinks * $maxRows_alllinks;

mysql_select_db($database_parkwaydb_connection, $parkwaydb_connection);
$query_alllinks = "SELECT tbl_links.links_title, tbl_links.links_url, tbl_links.links_desc, tbl_category.cat_title, tbl_category.cat_desc, tbl_user.user_firstname, tbl_user.user_familyname, tbl_links.links_id FROM tbl_links, tbl_category, tbl_user WHERE tbl_links.fk_links_user_id=tbl_user.user_id ORDER BY links_id DESC";
$query_limit_alllinks = sprintf("%s LIMIT %d, %d", $query_alllinks, $startRow_alllinks, $maxRows_alllinks);
$alllinks = mysql_query($query_limit_alllinks, $parkwaydb_connection) or die(mysql_error());
$row_alllinks = mysql_fetch_assoc($alllinks);

if (isset($_GET['totalRows_alllinks'])) {
  $totalRows_alllinks = $_GET['totalRows_alllinks'];
} else {
  $all_alllinks = mysql_query($query_alllinks);
  $totalRows_alllinks = mysql_num_rows($all_alllinks);
}
$totalPages_alllinks = ceil($totalRows_alllinks/$maxRows_alllinks)-1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License

Name       : Arthropod  
Description: A two-column, fixed-width design with dark color scheme.
Version    : 1.0
Released   : 20100422

-->
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/site_template.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>The Parkway Child Care Centre and Beaumont Hills Longday Pre-school</title>
<script type="text/javascript" language="javascript" src="js/behavior.js"></script>
<script type="text/javascript" language="javascript" src="js/rating.js"></script>

<!-- InstanceEndEditable -->

<!-- CSS FILES -->
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
<link href="css/datepicker.css" rel="stylesheet" type="text/css" />

<!-- JAVASCRIPT RELATED FILES -->
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/mosaic.1.0.1.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/datepicker.js"></script>
<script type="text/javascript" src="js/eye.js"></script>
<script type="text/javascript" src="js/utils.js"></script>

		
<script type="text/javascript">  
			
			jQuery(function($){
				
				$('.circle').mosaic({
					opacity		:	0.8			//Opacity for overlay (0-1)
				});
				
				$('.fade').mosaic();
				
				$('.bar').mosaic({
					animation	:	'slide'		//fade or slide
				});
				
				$('.bar2').mosaic({
					animation	:	'slide'		//fade or slide
				});
				
				$('.bar3').mosaic({
					animation	:	'slide',	//fade or slide
					anchor_y	:	'top'		//Vertical anchor position
				});
				
				$('.cover').mosaic({
					animation	:	'slide',	//fade or slide
					hover_x		:	'400px'		//Horizontal position on hover
				});
				
				$('.cover2').mosaic({
					animation	:	'slide',	//fade or slide
					anchor_y	:	'top',		//Vertical anchor position
					hover_y		:	'80px'		//Vertical position on hover
				});
				
				$('.cover3').mosaic({
					animation	:	'slide',	//fade or slide
					hover_x		:	'400px',	//Horizontal position on hover
					hover_y		:	'300px'		//Vertical position on hover
				});
		    
		    });
		    
		</script>
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>
<body>

<div id="wrapper">

    <div id="header">
        <div id="logo">
            <p><h4><a href="index.php">Home</a> | <a href="aboutus.php">About Us</a> | <a href="contactus.php">Contact Us</a> | <img src="images/administrator.png" width="16" height="16" alt="Admin" /><a href="admin/index.php">Admin</a> &nbsp;<br /></h4></p>
            <p>
            <a href="javascript:decreaseFontSize()" class="nohover"><img src="images/font-sizer-down.gif" alt="Decrease font size" width="25" height="25" border="0" /></a>
            <a href="javascript:increaseFontSize()" class="nohover"><img src="images/font-sizer-up.gif" alt="Increase font size" width="25" height="25" border="0" /></a>
            </p>
        </div>
    </div>

  <div id="spacing"> <br /> </div>  
    
  <div id="menuboxes">
    <div class="mosaic-block bar2">
              <a href="news.php" title="View Latest News" class="mosaic-overlay">
              <div class="details">
                <h4>News</h4> 
                <p>Check the latest news!</p>
              </div>
              </a>
            <div class="mosaic-backdrop"><img src="images/1.jpg" width="190" height="200" alt="News"/></div>
        </div>
        <div class="mosaic-block bar2">
              <a href="gallery.php" title="View the Gallery" class="mosaic-overlay">
              <div class="details">
                <h4>Gallery</h4>
                <p>View pictures</p>
              </div>
              </a>
              <div class="mosaic-backdrop"><img src="images/2.jpg" width="190" height="200" alt="Gallery"/></div>
        </div>
        <div class="mosaic-block bar2">
              <a href="linksarticles.php" title="View Articles and Links" class="mosaic-overlay">
              <div class="details">
                <h4>Articles and Links</h4>
                <p>Important articles and links</p>
              </div>
              </a>
              <div class="mosaic-backdrop"><img src="images/3.jpg" width="190" height="200" alt="Articles and Links"/></div>
        </div>
        <div class="mosaic-block bar2">
              <a href="staff.php" title="View Staff Information" class="mosaic-overlay">
              <div class="details">
                <h4>Staff</h4> 
                <p>Details on our Staff</p>
              </div>
              </a>
              <div class="mosaic-backdrop"><img src="images/4.jpg" width="190" height="200" alt="Staff Information"/></div>
        </div>
      </div>

	
  <div id="spacing"> <br /> </div>  
    
  <div id="page">
		<div id="page-bgtop">
				<div id="content"><!-- InstanceBeginEditable name="main_region" --><br />
                <div class="post">
                    <h1 class="title">Articles and Links</h1> 
                    <div style="clear: both;">&nbsp;</div>
                    <div  id="contentpost" class="entry">
                    Displayed here are the last 10 articles or <a href="allarticles.php">click here to view <strong>all</strong> articles</a>

                      <?php do { ?>
                      <table width="100%" class="articleTab">
                        <tr>
                          <td colspan="2" class="articlesTd"><h2><a href="arti?articles_id=<?php echo $row_allarticles['articles_id']; ?>"><?php echo $row_allarticles['articles_title']; ?></a></h2></td>
                          </tr>
                        <tr>
                          <td colspan="2" class="articlesTd"><?php echo $row_allarticles['articles_short']; ?></td>
                        </tr>
                        <tr class="meta">
                          <td width="30%" class="articlesTd"><?php echo Date('jS M Y h:i a', strtotime($row_allarticles['articles_date'])); ?></td>
                          <td class="articlesTd">Written by <a href="mailto:<?php echo $row_allarticles['user_email']; ?>" title="Email the author"><?php echo $row_allarticles['user_firstname']; ?> <?php echo $row_allarticles['user_familyname']; ?></a></td>
                        </tr>
                      </table>
                      <p>&nbsp;</p>
                        <?php } while ($row_allarticles = mysql_fetch_assoc($allarticles)); ?>
                      <p>&nbsp;</p>
                      <p>Here are the last 10 links or <a href="alllinks.php">click here to view <strong>all</strong> links</a></p>
                      <?php do { ?>
                          <table width="100%" class="articlesTab">
                            <tr>
                              <td width="20%" valign="top" class="articlesTd"><strong>Link Title:</strong></td>
                              <td width="80%" class="articlesTd"><?php echo $row_alllinks['links_title']; ?></td>
                              </tr>
                            <tr>
                              <td valign="top" class="articlesTd"><strong>Web Address:</strong></td>
                              <td class="articlesTd"><a href="<?php echo $row_alllinks['links_url']; ?>" target="_blank"><?php echo $row_alllinks['links_url']; ?></a></td>
                              </tr>
                            <tr>
                              <td valign="top" class="articlesTd"><strong>Description:</strong></td>
                              <td class="articlesTd"><?php echo $row_alllinks['links_desc']; ?></td>
                              </tr>
                            <tr>
                              <td valign="top" class="articlesTd"><strong>Category:</strong></td>
                              <td class="articlesTd"><?php echo $row_alllinks['cat_title']; ?></td>
                              </tr>
                          </table>
                          <p>&nbsp;</p>
					  <?php } while ($row_alllinks = mysql_fetch_assoc($alllinks)); ?>
                    </div>  
                </div> 
                <div style="clear: both;">&nbsp;</div>    
          <!-- InstanceEndEditable --></div>
			<!-- end #content -->
            <div id="sidebar"><!-- InstanceBeginEditable name="sidebar_region" -->
        					<ul>
						<li>
							<div id="search" >
								<form method="get" action="#">
									<div>
										<input type="text" name="s" id="search-text" value="" /><br />
										<input type="submit" id="search-submit" value="GO" />
									</div>
								</form>
							</div>
							<div style="clear: both;">&nbsp;</div>
						</li>
						<li>
							<h2>Date</h2>
						  <p><?php print(Date("jS M Y")); ?></p>
						</li>
						<li>
							<h2>News</h2>
							<ul>
								<?php do { ?>
							    	<li><a href="news.php?news_id=<?php echo $row_recent_news['news_id']; ?>"><?php echo $row_recent_news['news_title']; ?></a></li>
								<?php } while ($row_recent_news = mysql_fetch_assoc($recent_news)); ?>
                            </ul>
						</li>
						<li>
							<h2>Articles</h2>
							<ul>
								<li><a href="#">Aliquam libero</a></li>
								
							</ul>
						</li>
						<li>
							<h2>Archives</h2>
							<ul>
								<li><a href="#">Aliquam libero</a></li>
								<li><a href="#">Consectetuer adipiscing elit</a></li>
								<li><a href="#">Metus aliquam pellentesque</a></li>
								<li><a href="#">Suspendisse iaculis mauris</a></li>
								<li><a href="#">Urnanet non molestie semper</a></li>
								<li><a href="#">Proin gravida orci porttitor</a></li>
								<li><a href="#">Suspendisse iaculis mauris</a></li>
								<li><a href="#">Urnanet non molestie semper</a></li>
							</ul>
						</li>
					</ul>

        
<!-- InstanceEndEditable --></div>
                    <!-- end #sidebar -->
			  <div style="clear: both;">&nbsp;</div>
		</div>
	</div>
	<!-- end #page -->
</div>

  <div id="spacing"> <br /> </div>  


<div id="footer">
	<p><a href="index.php">Home</a> | <a href="aboutus.php">About Us</a> | <a href="contactus.php">Contact Us</a> | <a href="news.php">News</a> | <a href="gallery.php">Gallery</a> | <a href="linksarticles.php">Links and Articles</a> | <a href="staff.php">Staff</a> | <a href="admin/index.php">Admin</a></p>
  <p>Copyright &copy; 2011 The Parkway Child Care Centre and Beaumont Hills Longday Pre-school. All rights reserved.<br />
Website Design by Igor Chuprov</p><br />
</div>
<!-- end #footer -->
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($recent_news);

mysql_free_result($allarticles);

mysql_free_result($alllinks);
?>
